Skip to content

Conversation

@kieran-osgood-shopify
Copy link
Contributor

@kieran-osgood-shopify kieran-osgood-shopify commented Jan 7, 2026

What changes are you making?

We added modules/@shopify/checkout-sheet-kit/src/ShopifyCheckoutEventProvider.tsx during prototyping but we don't need to keep it around, this will help simplify integration paths by reusing existing providers

This is technically a breaking change, but it just involves removing a provider so we will document as such to improve the design

I was adding testing and it was quite awkward because we perform the NativeModule import in the Component file

const RCTCheckoutWebView =
  requireNativeComponent<NativeShopifyCheckoutWebViewProps>(
    'RCTCheckoutWebView',
  );

This led to each file having a mock like this:

jest.mock('react-native', () => {
  const RN = jest.requireActual('react-native');
  const React = jest.requireActual('react');

  RN.UIManager.getViewManagerConfig = jest.fn(() => ({
    Commands: {},
  }));

  RN.NativeModules.ShopifyCheckoutSheetKit = {
    version: '0.7.0',
    preload: jest.fn(),
    present: jest.fn(),
    dismiss: jest.fn(),
    invalidateCache: jest.fn(),
    getConfig: jest.fn(async () => ({preloading: true})),
    setConfig: jest.fn(),
    addEventListener: jest.fn(),
    removeEventListeners: jest.fn(),
    initiateGeolocationRequest: jest.fn(),
    configureAcceleratedCheckouts: jest.fn(),
    isAcceleratedCheckoutAvailable: jest.fn(),
  };

  // Create mock component
  const MockRCTCheckoutWebView = (props: any) => {
    return React.createElement('View', props);
  };

  return Object.setPrototypeOf(
    {
      requireNativeComponent: jest.fn(() => MockRCTCheckoutWebView),
    },
    RN,
  );
});

So I moved it to its own file and created a global mock for it (less we mess with mocking react-native the more predictable our tests will be)

this doesn't affect public interface


PR Checklist

Important

Releasing a new version of the kit?


Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the refactor.pd/remove-shopify-event-provider branch 2 times, most recently from b425007 to 172b33b Compare January 8, 2026 10:42
@github-actions
Copy link

github-actions bot commented Jan 8, 2026

Coverage Report

Lines Statements Branches Functions
Coverage: 94%
94.75% (271/286) 91.79% (123/134) 97.5% (78/80)

@kieran-osgood-shopify kieran-osgood-shopify force-pushed the refactor.pd/remove-shopify-event-provider branch 2 times, most recently from 84e422b to 957891a Compare January 8, 2026 17:48
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review January 8, 2026 17:51
@kieran-osgood-shopify kieran-osgood-shopify requested a review from a team as a code owner January 8, 2026 17:51
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the refactor.pd/remove-shopify-event-provider branch from 957891a to e40b0c5 Compare January 8, 2026 17:51
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as draft January 9, 2026 12:47
@kieran-osgood-shopify kieran-osgood-shopify force-pushed the refactor.pd/remove-shopify-event-provider branch from e40b0c5 to 24aaf8e Compare January 13, 2026 15:19
@kieran-osgood-shopify kieran-osgood-shopify marked this pull request as ready for review January 13, 2026 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant